home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9640 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  59 lines

  1. Path: Gamma.RU!srcc!newsserver
  2. Newsgroups: comp.lang.c++
  3. References: <Dn65GG.M19@twisto.eng.hou.compaq.com>
  4. Message-ID: <AB9m_CnaPA@r-style.msk.su>
  5. Organization: JV R-Style
  6. Date: Wed, 28 Feb 1996 09:54:01 +0300 (MSK)
  7. From: "Alex Lubimov" <lubimov@r-style.msk.su>
  8. X-Mailer: dMail [Demos Mail for DOS v1.23]
  9. Subject: Re: BC++. Pls help me with precompiled headers...
  10. Distribution: su
  11. Sender: news-service@srcc.msu.su
  12. X-Return-Path: gamma!rstyle!r-style.msk.su!lubimov
  13.  
  14. <jhenell@bangate.eur.compaq.com> wrote:
  15.  
  16. >When compiling I get the following error message:
  17. >"Warning LEATHER.CPP 47: Cannot create pre-compiled header: code in
  18. >header"
  19. >(the 47th line  is the constructor of one of the classes,
  20. >"Leather::Leather() (" )
  21.  
  22. This message occurs when you place non-inline code in your header
  23. file, i.e. something like this:
  24.  
  25. /******************************/
  26. class A
  27. {
  28.  protected:
  29.            int x;
  30.  public:
  31.            A ( int n = 0 );
  32. };
  33.  
  34. A::A ( int n )  {  x = n; }
  35. /*******************************/
  36.  
  37. The code for constructor will:
  38.     a) not be expanded inline
  39.     b) will be placed in each module where you include this
  40.        header file.
  41.  
  42. To correct the problem you will want to do any of the following:
  43.  
  44. 1. place all function definitions in .CPP file
  45.  
  46. 2. declare function to be 'inline' (in this case function
  47.    definition should reside in .H or .HPP file):
  48.  
  49.    inline A::A ( int n )  {  x = n; }
  50.  
  51.  
  52. Hope this helps...
  53.  
  54.  
  55. Yours,
  56. Alex
  57.  
  58.  
  59.